package org.dyndns.opendemogroup.optimizer.operations;

import org.dyndns.opendemogroup.optimizer.Member;

/**
 * Based on "ReciprocalExchange", described on slide 21 of
 * <code>crossover.pdf</code>.
 */
public class ReciprocalExchangeMutator extends OrderPreservingOperationBase
{

	@Override
	void perform ( Member parentOne, Member parentTwo, Member child, int a,
			int b )
	{
		child.copyFrom ( parentOne, 0, parentOne.getMemberSize ( ) - 1 );
		child.genome[a] = parentOne.genome[b];
		child.genome[b] = parentOne.genome[a];
	}
}
